@if(isset($data) && $data->type == 'image')
    @foreach(json_decode($data->content, true) ?? [] as $key => $image)
        <fieldset style="margin-bottom: 10px">
            <legend>图片广告</legend>
            <div class="layui-form-item">
                <label class="layui-form-label">图片</label>
                <div class="layui-input-block layuimini-upload">
                    <input name="image[path][{{$key}}]" class="layui-input layui-col-xs6" placeholder="请上传图片"
                           value="{{$image['path']}}">
                    <div class="layuimini-upload-btn">
                            <span><a class="layui-btn" data-upload="image[path][{{$key}}]" data-upload-number="one"
                                     data-upload-exts="ico|png|jpg|jpeg"><i class="fa fa-upload"></i> 上传</a></span>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">链接</label>
                <div class="layui-input-block">
                    <input type="text" name="image[url][{{$key}}]" class="layui-input" placeholder="请输入链接"
                           value="{{$image['url']}}">
                </div>
            </div>
        </fieldset>
    @endforeach
@else
    <fieldset style="margin-bottom: 10px">
        <legend>图片广告</legend>
        <div class="layui-form-item">
            <label class="layui-form-label">图片</label>
            <div class="layui-input-block layuimini-upload">
                <input name="image[path][0]" class="layui-input layui-col-xs6" placeholder="请上传图片"
                       value="">
                <div class="layuimini-upload-btn">
                            <span><a class="layui-btn" data-upload="image[path][0]" data-upload-number="one"
                                     data-upload-exts="ico|png|jpg|jpeg"><i class="fa fa-upload"></i> 上传</a></span>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">链接</label>
            <div class="layui-input-block">
                <input type="text" name="image[url][0]" class="layui-input" placeholder="请输入链接" value="">
            </div>
        </div>
    </fieldset>
@endif


<div class="layui-form-item" id="add-image">
    <label class="layui-form-label"></label>
    <div class="layui-input-block">
        <button type="button" id="add-image-button"
                class="layui-btn layui-btn-primary layui-btn-sm">新增链接 +
        </button>
    </div>
</div>
